<template>
  <div class="itemContainer" :class="{finish:props.finish}">
    <span class="itemBox">
      <!-- 选择框 -->
      <input type="checkbox" @change="change" name="" id="" :checked="props.finishg">
      <!-- 内容 -->
      <span>{{ props.content }}</span>
    </span>
    <!-- 删除 -->
    <span class="delete" @click="deletething">x</span>
  </div>
</template>

<script setup>
import { useThingsStore } from '../store/thingsStore';
const props = defineProps({
  content:{
    type:String
  },
  id:{
    type:Number
  },
  finish:{
    type:Number
  }
})
const thingsStore = useThingsStore()
function change(){
  thingsStore.changeList(props.id,props.finish)
}
function deletething(){
  thingsStore.deleteList(props.id)  
}
</script>

<style scoped>
  .itemContainer {
    width: 94%;
    background-color: white;
    margin: 5px 0;
    height: 45px;
    line-height: 40px;
    border-radius: 5px;
    padding: 0 3%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .finish {
    background-color: #e7e7e7;
  }
  .itemBox {
    display: flex;
    align-items: center;
  }
  .itemBox input {
    /* background-color: red; */
    display: inline-block;
    width: 20px;
    height: 20px;
  }
  .delete {
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
  }
  .delete:hover {
    color: rgb(154, 21, 21);
  }
</style>